<template>
	<view>
		<u-navbar title="钱包"></u-navbar>
		
		<!-- <view class="container">
			<view class="cardBox">
				<image src="../../static/img/vipCenterBg.png" mode="" class="card"></image>
			</view>
			<view class="btnGroup">
				<view class="right">
					<view class="list">
						<view class="item" @click="toPage(0,'/pages/record/record?type=0&price='+retObj.using)">
							<image src="../../static/img/myMoney.png" mode="" style="width: 50upx;height: 53upx;"></image>
							<view class="title">余额</view>
						</view>
						<view class="item" @click="toPage(0,'/pages/record/record?type=1&price='+retObj.freeBean)">
							<image src="../../static/img/zuanshi.png" mode="" style="width: 58upx;height: 54upx;"></image>
							<view class="title">钻石</view>
						</view>
						<view class="item" @click="toPage(0,'/pages/record/record?type=2&price='+retObj.startUpValue)">
							<image src="../../static/img/yuanzuan.png" mode="" style="width: 62upx;height: 55upx;"></image>
							<view class="title">原钻</view>
						</view>
						<view class="item" @click="toPage(0,'/pages/record/record?type=3&price='+retObj.coupons)">
							<image src="../../static/img/mycoupons.png" mode="" style="width: 62upx;height: 59upx;"></image>
							<view class="title">消费券</view>
						</view>
						<view class="item" @click="toPage(0,'/pages/record/record?type=4&price='+retObj.freeBeanPoint)">
							<image src="../../static/img/xiandouDian.png" mode="" style="width: 78upx;height: 63upx;"></image>
							<view class="title">闲豆点</view>
						</view> 
					</view>
				</view>
			</view>
		</view> -->
		<view class="content">
			<view class="list">
				<view class="item" @click="toPage(0,'/pages/record/record?price='+retObj.using)">
					<image  class="icon" src="../../static/img/myMoney.png"></image>
					<view class="left">
						余额
					</view>
					<view class="right iconfont icon-fanhui"></view>
				</view>
			</view>
			<view class="list">
				<view class="item" @click="toPage(0,'/pages/record/zuanRecord?price='+retObj.diamond)">
					<image class="icon" src="../../static/img/zuanshi.png"></image>
					<view class="left">
						钻石
					</view>
					<view class="right iconfont icon-fanhui"></view>
				</view>
			</view>
			<view class="list">
				<view class="item" @click="toPage(0,'/pages/record/yuanZuanRecord?price='+retObj.frozenAssets)">
					<image class="icon" src="../../static/img/yuanzuan.png"></image>
					<view class="left">
						原钻
					</view>
					<view class="right iconfont icon-fanhui"></view>
				</view>
			</view>
			<view class="list">
				<view class="item" @click="toPage(0,'/pages/redRecord/redRecord')">
					<image class="icon" src="../../static/img/redbao.png"></image>
					<view class="left">
						红包
					</view>
					<view class="right iconfont icon-fanhui"></view>
				</view>
			</view>
			<view class="list">
				<view class="item" @click="toPage(0,'/pages/record/coupon?price='+retObj.coupons)">
					<image class="icon" src="../../static/img/mycoupons.png"></image>
					<view class="left">
						消费券
					</view>
					<view class="right iconfont icon-fanhui"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import * as api from "@/api/user/index.js";
	import * as money from "@/api/user/money.js";
	export default {
		data() {
			return {
				retObj:{},
				dataBody:{}
			}
		},
		created(){
			
		},
		onShow() {
			this.getWalletSysConfig()
			this.shopGetWalletSysConfig()
			this.getUserWallet();
			this.getUserWalletInfo()
		},
		methods: {
			async getUserWallet() {
				try {
					const ret = await api.getUserWallet();
					// this.moneyNumber = ret.data.obj.
						this.retObj.using = ret.data.obj.using,
						this.retObj.coupons = ret.data.obj.coupons		//消费券
				} catch (error) {
					
				}
			},
			async shopGetWalletSysConfig() {
					api.getWalletSysConfig().then(res=>{
						// balanceRechargeOpen: 1//充值开关
						// balanceTaxRate: 0.005 //提现手续费比例
						// balanceTransferDiamondOpen: 1 //兑换钻石开关
						// balanceTransferDiamondTaxRate: 0 //兑换钻石手续费比例
						// balanceTransferDiamondZhengShuBei: 50 //兑换钻石整数倍
						// balanceWithdrawalOpen: 1 //提现开关
						// balanceWithdrawalTaxRate: 0.005 //提现手续费
						// balanceWithdrawalZhengShuBei: 50 //提现整数倍
						// balanceZhuanZhangOpen: 0 //转账开关
						// balanceZhuanZhangZhengShuBei: 50 //转账整数倍
						this.$store.commit("setShopDataBody",res.data.obj)
					}).catch (err=>{
						
					}) 
			},
			getWalletSysConfig(){
				money.getWalletSysConfig().then(res=>{
					// diamondTaxRate	string	钻石转账手续费比例
					// diamondZhuanZhangOpen	int	钻石转账开关 0关 1开
					// diamondZhuanZhangZhengShuBei	string	钻石转账整数倍
					// diamondTransferYueTaxRate	string	钻石兑换余额手续费比例
					// diamondTransferYueOpen int	钻石兑换余额开关 0关 1开
					// yuanDiamondZhuanZhangOpen	int	原钻转账开关 0关 1开
					// yuanDiamondZhuanZhangZhengShuBei	string	原钻转账整数倍
					// yuanDiamondTaxRate	string	原钻转账手续费比例
					this.dataBody = res.data.dataBody
					this.$store.commit("setDataBody",this.dataBody)
					console.log(this.$store.state.dataBody)
		
				}).catch(err=>{
					
				})
			},
			getUserWalletInfo(){
				money.getUserWalletInfo().then(res=>{
					this.retObj.diamond = res.data.dataBody.diamond
					this.retObj.frozenAssets = res.data.dataBody.frozenAssets
				}).catch(err=>{
					
				})
			}
		}
	}
</script>

<style lang="scss">
@import  './index.scss';
</style>
